import { Env } from "#Config/base.js"
import path from 'path'

// 获取跟目录
const cachePath = path.join(process.cwd(), 'storage', 'cache')
Env


export default {
    default: process.env.CACHE_DRIVER || 'file',
    prefix: (process.env.CACHE_PREFIX || 'koa') + '-cache',
    stores: {
        file: {
            driver: 'file',
            ttl: 1000 * 60 * 60 * 24 * 30, // 30 days
            storage: cachePath
        },
        redis: {
            driver: 'redis',
            host: process.env.REDIS_HOST || '127.0.0.1',
            port: process.env.REDIS_PORT || 6379,
            password: process.env.REDIS_PASSWORD || '',
            db: process.env.REDIS_CACHE_DB || 0,
        }
    }
}